/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.subway.persistencias;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Héctor <UFG>
 */
@Entity
@Table(name = "cat_pais", catalog = "bd_subway", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "CatPais.findAll", query = "SELECT c FROM CatPais c"),
    @NamedQuery(name = "CatPais.findByPaisId", query = "SELECT c FROM CatPais c WHERE c.paisId = :paisId"),
    @NamedQuery(name = "CatPais.findByPaisInicial", query = "SELECT c FROM CatPais c WHERE c.paisInicial = :paisInicial"),
    @NamedQuery(name = "CatPais.findByPaisNombre", query = "SELECT c FROM CatPais c WHERE c.paisNombre = :paisNombre"),
    @NamedQuery(name = "CatPais.findByPaisCodArea", query = "SELECT c FROM CatPais c WHERE c.paisCodArea = :paisCodArea")})
public class CatPais implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "paisId")
    private Integer paisId;
    @Basic(optional = false)
    @NotNull
    @Column(name = "paisInicial", nullable = false)
    private char paisInicial;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "paisNombre", nullable = false, length = 30)
    private String paisNombre;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(name = "paisCodArea", nullable = false, length = 5)
    private String paisCodArea;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "sucPaisId")
    private List<Sucursal> sucursalList;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "empPaisId")
    private List<Empleado> empleadoList;

    public CatPais() {
    }

    public CatPais(Integer paisId) {
        this.paisId = paisId;
    }

    public CatPais(Integer paisId, char paisInicial, String paisNombre, String paisCodArea) {
        this.paisId = paisId;
        this.paisInicial = paisInicial;
        this.paisNombre = paisNombre;
        this.paisCodArea = paisCodArea;
    }

    public Integer getPaisId() {
        return paisId;
    }

    public void setPaisId(Integer paisId) {
        this.paisId = paisId;
    }

    public char getPaisInicial() {
        return paisInicial;
    }

    public void setPaisInicial(char paisInicial) {
        this.paisInicial = paisInicial;
    }

    public String getPaisNombre() {
        return paisNombre;
    }

    public void setPaisNombre(String paisNombre) {
        this.paisNombre = paisNombre;
    }

    public String getPaisCodArea() {
        return paisCodArea;
    }

    public void setPaisCodArea(String paisCodArea) {
        this.paisCodArea = paisCodArea;
    }

    @XmlTransient
    public List<Sucursal> getSucursalList() {
        return sucursalList;
    }

    public void setSucursalList(List<Sucursal> sucursalList) {
        this.sucursalList = sucursalList;
    }

    @XmlTransient
    public List<Empleado> getEmpleadoList() {
        return empleadoList;
    }

    public void setEmpleadoList(List<Empleado> empleadoList) {
        this.empleadoList = empleadoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (paisId != null ? paisId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CatPais)) {
            return false;
        }
        CatPais other = (CatPais) object;
        if ((this.paisId == null && other.paisId != null) || (this.paisId != null && !this.paisId.equals(other.paisId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.paisNombre + " [" + this.paisCodArea + "]";
    }
    
}
